﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
    <title>无标题页</title>
    <script src="../../My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery-1.9.1.js" type="text/javascript"></script>
    <script src="../../Content/JS/layer-v1.7.1/layer/layer.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <link href="../../Content/Themes/blue2/css.css" rel="stylesheet" type="text/css" />
    <link href="../../Content/tablecloth/tablecloth.css" rel="stylesheet" type="text/css" />
    <link href="../../CSS/gh-buttons.css" rel="stylesheet" type="text/css" />
    <!--以下css为兼容IE6-->
    <style type="text/css">
        #pageDIV{  text-align:center; margin-left:25%;padding-bottom:5px;} 
        		body{width:950px;margin:0 auto;font-family:trebuchet ms;text-align:left;margin-top:10px;}
		#rightclickarea{padding:50px 0;width:620px;text-align:center;border:1px solid #ccc;margin-top:10px;}
        .vmenu{
		border:1px solid #aaa; 
		position:absolute;
		background:#fff;
		display:none;font-size:0.75em;}
		.first_li{}
		.first_li span{width:100px;display:block;padding:5px 10px;cursor:pointer}
		.inner_li{display:none;margin-left:120px;position:absolute;border:1px solid #aaa;border-left:1px solid #ccc;margin-top:-28px;background:#fff;}
		.sep_li{border-top: 1px ridge #aaa;margin:5px 0}
		.fill_title{font-size:11px;font-weight:bold;/height:15px;/overflow:hidden;word-wrap:break-word;}
        
         
        
        html
        {
            background: url(images/main_bg.png) left -1px repeat-x;
            background-attachment: fixed;
        }
        #salarySchedule
        {
            padding: 20px 5px 20px 5px;
        }
        #salaryScheduleBox
        {
            position: relative;
        }
        #salaryScheduleBox table td
        {
            border-right: solid 1px #ccc;
            height: 40px;
            text-align: right;
            vertical-align: bottom;
            width: 30px;
        }
        #salaryScheduleContainer
        {
            width: 390px;
            overflow: hidden;
            border-bottom: solid 1px #d2d2d2;
            position: absolute;
            top: 0;
            height: 20px;
            background: #fff;
        }
        #salaryScheduleContainer .item
        {
            position: absolute;
            background: #ff6600;
            height: 20px;
            top: 0;
            border-right: solid 1px #cb5100;
            line-height: 20px;
            text-align: center;
            cursor: pointer;
        }
        #salaryScheduleTips
        {
            margin: 10px 0px 0px 0px;
            line-height: 20px;
        }
       .main .path .nav a{ margin-top:1px;}
       .main .path {  border-bottom:solid 0px #6a9fe2;position:relative; height:25px;}
       .ShowBtn{ text-align:right; margin-right:10px;}
       .AllTopDiv{margin-top:10px;}
    </style>

    <script type="text/javascript" src="../../Content/Js/Simple.js"></script>

    <script type="text/javascript" src="../../Content/Js/eqccd.js"></script>

    <script type="text/javascript" src="../../Content/js/jquery.ui.core.js"></script>

    <script type="text/javascript" src="../../Content/js/jquery.ui.widget.js"></script>

    <script type="text/javascript" src="../../Content/js/jquery.ui.mouse.js"></script>

    <script type="text/javascript" src="../../Content/js/jquery.ui.sortable.js"></script>

    <script src="../../Content/Js/ioa.js" type="text/javascript"></script>

    <script src="../../Content/Js/HMS.js" type="text/javascript"></script>

    
    <script type="text/javascript">
     var CurrentPage=1;
      var numPage=10;
      var countPage=1;
      var ListPage=1;
        var jq = jQuery.noConflict(); //解决和simple  $冲突
        jq(function () {
            jq("#zone1, #zone2").sortable({
                connectWith: ".connectedSortable",
                helper: "clone",
                stop: function (r) {
                    var list1 = jq("#zone1 .title");
                    var list2 = jq("#zone2 .title");
                    jq.post("desktop.aspx", { cmd: "save", z1: getSetting(list1), z2: getSetting(list2) });
                }
            }).disableSelection();
        });
        function getSetting(list) {
            var s = "";
            for (var i = 0; i < list.length; i++) {
                s += list[i].id + (i == list.length - 1 ? "" : ",");
            }
            return s;
        }
          function wastebook()
        {
            $("#RightMenus").css('display','none'); 
            $.ajax({
                type:"POST",
                url:"<%:Url.Action("wastebookLoad","Desktop") %>",
                data:"memberId="+memberID+"&numPage="+numPage+"",
                cache:false,
                success:function(html)
                {
//      
                     $("#tablecloth2").html(html);  
                    tablecloth(); 
                }
            })
        }
         
        function wastebook_nextPage()
        {
            $.ajax({
                type:"POST",
                url:"<%:Url.Action("wastebookNextPageLoad","Desktop") %>",
                data:"memberId="+memberID+"&numPage="+numPage+"&CurrentPage="+CurrentPage+"",
                cache:false,
                success:function(html)
                {
                     $("#tablecloth2").html(html);
                     tablecloth(); 
                }
               
            })
        }
         
           

        var wFormCount = 0;
        function setCount(name, code) {
            var url = "Settings/UserRecordCount.aspx?Title=" + escape(name) + "&FormCode=" + code;
            new UI.openForm(350, 200, name, "url:" + url, null, true);
            //以下解决ie进度条bug
            wFormCount++;
            if (wFormCount == 1) {
                document.body.getElementsByTagName("iframe")[0].src = url;
            }
        }

         function update() {
            var MemberId=$("#txtMemberId").val();
            var Name = $("#txtMemberName").val();
            var Sex = $("select[id='cbxSex']").val();
            var Mobile = $("#txtMobile").val();
            var Tel = $("#txtTel").val();
            var Email = $("#txtEmail").val();
            var IDNumber = $("#txtIDNumber").val();
            var BirthDay = $("#txtBirthDay").val();
            var CardType = $("select[id='cbxCardType']").val();
            var Balance = $("#txtBalance").val();
            var Point = $("#txtPoint").val();
            var Status = $("select[id='cbxStatus']").val();
            var CreateDate = $("#txtCreateDate").val();
            var ExpiresDateDate = $("#txtExpiresDateDate").val();
            var Consume = $("#txtConsume").val();
            var Marriage = $("input[name='Marriage']:checked").val();
            var Zip = $("#txtZip").val();
            var Address = $("#txtAddress").val();
            var Areas = $("select[id='cbxAreas']").val();
            var MemberType = $("select[id='cbxMemberType']").val();
            var Memo = $("#txtMemo").val();
            $.ajax({
                type:"POST",
                url:"<%: Url.Action("updateSubmit","Desktop") %>",
                data:"MemberId="+MemberId+"&Name="+Name+"&Sex="+Sex+"&Mobile="+Mobile+"&Tel="+Tel+"&Email="+Email+"&IDNumber="+IDNumber+"&BirthDay="+BirthDay+"&Balance="+Balance+"&CardType="+CardType+"&Point="+Point+"&Status="+Status+"&CreateDate="+CreateDate+"&ExpiresDateDate="+ExpiresDateDate+"&Consume="+Consume+"&Marriage="+Marriage+"&Zip="+Zip+"&Address="+Address+"&Areas="+Areas+"&MemberType="+MemberType+"&Memo="+Memo+"",
                cache:false,
                success:function(html)
                {
                    layer.alert(html,1,"提示",function(){
                        layer.closeAll();
                             $.ajax({
                                    type:"GET",
                                    url:"<%:Url.Action("Load","MemberInfo") %>",
                                    cache:false,
                                    success:function(html)
                                    {

                                        $("#memberList").html(html);
                                    }
                                    })

                        
                    });
                }
            })

         
        }
          function updateClose()
        {
           layer.closeAll();
        }
        $(document).ready(function(){
			
			$('#tablecloth').bind('contextmenu',function(e){

			var $cmenu = $(this).next();
			$('<div class="overlay"></div>').css({left : '0px', top : '0px',position: 'absolute', width: '100%', height: '100%', zIndex: '100' }).click(function() {
				$(this).remove();
				$cmenu.hide();
			}).bind('contextmenu' , function(){return false;}).appendTo(document.body);
			$(this).next().css({ left: e.pageX, top: e.pageY, zIndex: '101' }).show();

			return false;
			 });

              $('#tablecloth2').bind('contextmenu',function(e){

			var $cmenu = $(this).next();
			$('<div class="overlay"></div>').css({left : '0px', top : '0px',position: 'absolute', width: '100%', height: '100%', zIndex: '100' }).click(function() {
				$(this).remove();
				$cmenu.hide();
			}).bind('contextmenu' , function(){return false;}).appendTo(document.body);
			$(this).next().css({ left: e.pageX, top: e.pageY, zIndex: '101' }).show();

			return false;
			 });
             });
            
    </script>

</head>
<body style="width: 98%; margin: 0 auto">
 <div class="AllTopDiv">
   <div class="main">
        <div class="path">
            <div class="nav">
                <a href="#">会员管理</a>
            </div>
            <div class="ShowBtn">
                <input  type="button" value="读卡" class="button2" onclick="RfidCardReadSectorData()"/>
                <input name="button3" type="button" id="btn1" onclick="CardInOver()" value="进卡" class="button2"/>
                <input name="button2" type="button" id="btn2" onclick="Dischange()" value="退卡" class="button2"/>
                <input name="button3" type="button" id="btn3" onclick="Erase()" value="擦除卡面内容" class="button3"/>
                <input name="buttonSelf" type="button" id="Btn_self" onclick="return_self()" value="刷新" class="button2"/>
               </div>
        </div>
        
    
    <table width="100%" id="memberTable"  cellspacing="0" cellpadding="2">
        <tbody><tr>
   
           <td valign="top" style="width: 100%; overflow: hidden">
               <ul id="zone1" class="connectedSortable ui-sortable">
                    <li style="height: 1px; border: none; margin: 0; padding: 0; line-height: 1px;width: 100%;"></li>
                
<li style=" width:99%; height:405px; overflow:scroll;">
   

    <div id="_ctl1_content" >
       <table id="tablecloth" cellspacing="0" class="tablecloth" cellpadding="0" style=" margin-top:5px; margin-left:5px;">
																															
		</table>
        
            <div class="vmenu">

						<div class="first_li"><span id="XF" onmousemove="fs(this)";  onmouseout="fx(this)" onclick="MemberSale()" >会员消费</span></div>

						<div class="first_li"><span id="XG" onmousemove="fs(this)"; onmouseout="fx(this)" onclick="RightUpdate()">会员修改</span></div>

                        <div class="first_li"><span id="GS" onmousemove="fs(this)"; onmouseout="fx(this)" onclick="RightLostMain()">挂失办理</span></div>

                        <div class="first_li"><span id="CZ" onmousemove="fs(this)"; onmouseout="fx(this)" onclick="RightRecharge()">会员充值</span></div>

                        <div class="first_li"><span id="LX" onmousemove="fs(this)"; onmouseout="fx(this)" onclick="wastebook()">消费流水</span></div>
                       
                       <div class="first_li"><span id="CP" onmousemove="fs(this)"; onmouseout="fx(this)" onclick="changeCardPwd()">修改卡密码</span></div>

                        <div class="first_li"><span id="SC" onmousemove="fs(this)"; onmouseout="fx(this)" onclick="DelMember()">删除</span></div>
					</div>

        <div id="pageDIV" style=" float:left; width:400px;  ">
        
          <input  type="button" onmouseover="this.style.fontWeight='bold'" onmouseout="this.style.color='black';this.style.fontWeight='normal'" onclick="FirstPage()"style="cursor:pointer"  value="首页" class="buttonSame"/>
         <input type="button" value="上一页" onmouseover="this.style.fontWeight='bold'" onmouseout="this.style.color='black';this.style.fontWeight='normal'" onclick="UpperPage()"style="cursor:pointer" class="buttonSame"/>
         <input type="button" value="下一页" onmouseover="this.style.fontWeight='bold'" onmouseout="this.style.color='black';this.style.fontWeight='normal'" onclick="NextPage()"style="cursor:pointer" class="buttonSame"/>
         <input type="button" value="末页" onmouseover="this.style.fontWeight='bold'" onmouseout="this.style.color='black';this.style.fontWeight='normal'" onclick="EndPage()"style="cursor:pointer" class="buttonSame"/>
      
         
            <label id="labPage" style=" margin-left:20px;">1/10</label>
            <input type="text" id="txtJupmPage" style=" margin-left:20px; width:20px;" /> 
             <a href="javascript:JupmA()">转</a>
            </div>
             
                   
        <label></label>
      
 
</div>
</li>

<li style=" width:99%; height:200px; overflow:scroll;">
<div class="title" id="calendar">
<strong>消费流水</strong>
 
<div class="clear"></div>
</div>

<div>
  <table id="tablecloth2" cellspacing="0" class="tablecloth" cellpadding="0" >
																		
		       </table>
</div>
</li>
<li style=" width:99%; height:150px; overflow:scroll;">
    <div class="title" id="InternalMail">
<strong>消费详情</strong> 
<div class="clear"></div>
</div>

    <div>
          <table id="tablecloth3" cellspacing="0" class="tablecloth" cellpadding="0">
																		
		</table>
    </div>
</li>

</ul>
            </td> 
         

            <td valign="top" style="width: 50%; overflow: hidden">
                <ul id="zone2" class="connectedSortable">
                    <li style="height: 1px; border: none; margin: 0; padding: 0; line-height: 1px"></li>
                
<script type="text/javascript">


    function SignIn(o, id) {
        o.disabled = true;
        Ajax.post("desktop.aspx", function (r) {
            o.disabled = false;
            if (r == "0") {
                window.alert('成功');
                window.location = "SignInManagement/SignInSummary.aspx?opt=view";
            }
            else
                window.alert("失败");
        }, { cmd: "signin", id: id, r: Math.random() });
    }
</script>



</ul>
            </td>
        </tr></tbody>
    </table>

    <form name="_ctl0" method="post" action="desktop.aspx" id="_ctl0">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTA0NzAyMjI1OGRkbzcQrOtMmY/fUKUfjaYHDQUVedA=" />

<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBQKex7CdCQLQ5fHeCALD85KcCgLQ5bXPCALD89aMCp3lCCRgbq05arLGhvkB3go5UbFI" />
    </form>
    <input  type="hidden" id="SelectMemberId" /> 
     <p>
     <object classid="clsid:2323E9E1-2B2E-4BD2-9F66-1C2D02F7A29C" codebase="vcp400.cab" width="0" height="0" id="vcp400">
     </object>
    </div>
    </p>
  </div>
</body>
</html>

    <script type="text/javascript">

      $.ajax({
        type:"POST",
        url:"<%:Url.Action("Load","Desktop") %>",
        data:"numPage="+numPage+"&CurrentPage="+CurrentPage+"",
        cache:false,
        async:false,
        success:function(html)
        {  
           $("#tablecloth").html(html); 
        }
        })
   

        function memberUpdate(id)
        {
            $.ajax({
                type:"POST",
                url:"<%:Url.Action("Update","Desktop") %>",
                data:"id="+id+"",
                cache:false,
                success:function(html){
                    layerUpdate(html);
                }
            })
        }


          function layerUpdate(html)
        {
        
                   var i = $.layer({
                type: 1,
                title: false,
                closeBtn: false,
                border: [5, 0.5, '#666', true],
                offset: ['0px', ''],
                move: ['.juanmove', true],
                area: ['620px', '460px'],
                page: {
                    html: html
                    
                },
                success: function () {
                    layer.shift('top', 500);
                }
                        });
                  
             $('.juanLu').on('click', function(){
	            layer.closeAll();
            });
        
        }


        var memberID="";
        var wasteBookID="";
        function vc(obj)
        {
            $(obj).attr('name','rowRight');
            var $table= $("#tablecloth");
            var $trs=$table.find("tr");
            for (var i = 0; i < $trs.length; i++) {
                var $tr=$trs.eq(i);
                var $trName= $($tr).attr('name');
                if($trName=="rowRight")
                {
                    $tds= $tr.find("td");
                    memberID=$tds.eq(0).text();
                    $(obj).attr('name','row');
                }
            }
        }

         function vb(obj)
        {
            $(obj).attr("name","rowRight2")
            var $table=$("#tablecloth2");
            var $trs=$table.find("tr");
            for (var i = 0; i < $trs.length; i++)
            {
                var $tr=$trs.eq(i);
                var $trName=$($tr).attr('name');
                if($trName=="rowRight2")
                {
                    $tds= $tr.find("td");
                    wasteBookID=$tds.eq(0).text();
                    $(obj).attr('name','row');
                }
            }
        }
         function vc_memberId(obj)
        {
            $(obj).attr('name','rowRight');
            var $table= $("#tablecloth");
            var $trs=$table.find("tr");
            for (var i = 0; i < $trs.length; i++) {
                var $tr=$trs.eq(i);
                var $trName= $($tr).attr('name');
                if($trName=="rowRight")
                {
                    $tds= $tr.find("td");
                    memberID=$tds.eq(0).text();
                    $(obj).attr('name','row');
                     $.ajax({
                             type:"POST",
                              url:"<%:Url.Action("GetmemberId","Desktop") %>",
                             data:"memberId="+memberID+"",
                             cache:false,
                             success:function(txt){
                              
                                 }
                            })
                }
            }
        }
        //消费详情
        function xiangXi(obj)
        {
          vb(obj);
           $("#RightMenu2").css("display","none"); 
            $.ajax({
                type:"POST",
                url:"<%:Url.Action("goodsInfoLoad","Desktop") %>",
                data:"wasteBookId="+wasteBookID+"",
                cache:false,
                success:function(html)
                {
                    $("#tablecloth3").html(html);
                    tablecloth(); 
                }
            })
        }
     

        function fs(xz)
        {
            $(xz).css("background-color","#E0EDFE");
        }
        function fx(bz)
        {
            $(bz).css("background-color","#FFFFFF");
        }

        //修改会员
         //  function  Rightmenu()
        // {
             //memberUpdate(memberID);
        // }

           function  RightUpdate()
         {
             $("#RightMenus").css("display","none");
             memberUpdate(memberID);
         }

           function wasteBookpageCount_Load(memberId)
        {
            $.ajax({
                type:"POST",
                url:"<%:Url.Action("wasteBookpageCount","Desktop") %>",
                data:"numPage="+numPage+"&memberId="+memberId+"",
                cache:false,
                success:function(html)
                {
                    countPage=html;
                    CurrentPage=1;
                    $("#labPage").html(""+CurrentPage+"/"+html+"");

                }
            })
        }

         //会员消费
         function MemberSale()
         {
              $.layer({
                        type: 2,
                        title: false,
                        closeBtn:false,
                       shadeClose: true, //开启点击遮罩关闭层
                        move: ['.juanmove', true],
                       area: ['650px', '590px'],
                       offset: ['100px', ''],
                       iframe: { src: '/MemberSale/MemberSale/?memberId='+memberID },
                         success:function(){
                           layer.shift('top',500);
                                  }
                     });
         }

         // 挂失办理
         function RightLostMain()
         {    
                     $.layer({
                        type: 2,
                        title: false,
                        closeBtn:false,
                       shadeClose: true, //开启点击遮罩关闭层
                        move: ['.juanmove', true],
                       area: ['800px', '520px'],
                       offset: ['100px', ''],
                       iframe: { src: '/LostCard/LostCardMain/?memberId='+memberID },
                         success:function(){
                           layer.shift('top',500);
                                  }
                     });
             
           }
         // 会员充值
         function RightRecharge()
         {    
                     $.layer({
                        type: 2,
                        title: false,
                        closeBtn:false,
                       shadeClose: true, //开启点击遮罩关闭层
                        move: ['.juanmove', true],
                       area: ['680px', '520px'],
                       offset: ['100px', ''],
                       iframe: { src: '/Recharge/Recharge/?memberId='+memberID },
                         success:function(){
                           layer.shift('top',500);
                                  }
                     });
             
           }
           //修改卡密码
           function changeCardPwd(){
               $.layer({
                        type: 2,
                        title: false,
                        closeBtn:false,
                       shadeClose: true, //开启点击遮罩关闭层
                        move: ['.juanmove', true],
                       area: ['500px', '340px'],
                       offset: ['100px', ''],
                       iframe: { src: '/changeCardPwd/changeCardPwd/?memberId='+memberID },
                         success:function(){
                           layer.shift('top',500);
                                  }
                     });
           
           }
          //删除会员
          function DelMember()
          {
              $.layer({
                  shade:[0.5,'#000',true],
                  area:['310px', '130px'],
                  dialog:{
                      msg:'您确定要删除该会员吗',
                      btns:2,
                      type:4,
                      btn: ['确定','取消'],
                      yes:function(){
                          $.ajax({
                             type:"POST",
                              url:"<%:Url.Action("DelMember","Desktop") %>",
                             data:"memberId="+memberID+"",
                             cache:false,
                             success:function(txt){
                              layer.msg(txt,2,function(){location.reload('<%:Url.Action("Desktop","MemberInfo") %>');});
                                 }
                            })

                      },no:function(){
                         layer.closeAll();
                      }
                  }
              
              });
          }


        /* 控件用js 非公共js请写在控件中
        ------------------------------- */
        function Action(id, pagesign) {
            var url = "";
            switch (pagesign) {
                case "Purchase": url = "DispartSell/Purchase/RecordPurchase.aspx?operation=edit&ID=" + id; break;
                case "Order": url = "DispartSell/SaleManage/OrderOpt.aspx?operation=edit&pk_id=" + id + "&id=" + id; break;
                case "BorrowReturn": url = "DispartSell/Store/BorrowAdd.aspx?operation=edit&pk_id=" + id + "&id=" + id; break;
            }
            qc.open(url, 1000, 500);
        }
        function showClientInfo(id) {
            qc.open("Common/Client/ClientCenter.aspx?operation=view&mode=my&BT=Crm&page=&popup=1&ID=" + id, 1000, 600);
            return;
        }
        function showUserInfo(id) {
            qc.open('Settings/UserInfo.aspx?PK_ID=' + id, 550, 450);
        }
        var card1 = document.getElementById("tdcard1");
        var card2 = document.getElementById("tdcard2");
        function setClock(o, arr) {
            var list = o.getElementsByTagName("img");
            var src = list[0].src.substring(0, list[0].src.lastIndexOf('/') + 1);
            for (var i = 0; i < arr.length; i++)
                if (i != 2 && i != 5) {
                    list[i].src = src + "c" + arr[i] + ".gif";
                }
        }
        function showClock() {
            Ajax.get("desktop.aspx", function (r) {
                if (r == null) return;
                var a = eval(r);
                if (card1)
                    setClock(card1, a);
                if (card2)
                    setClock(card2, a);
            }, { cmd: "getTime", r: Math.random() });
            setTimeout(showClock, 1000);
        }
//        if (document.getElementById("card1") || document.getElementById("card2"))
//            showClock();

       // window.onerror = function () { return true; }

         function nextPageLoad()
        {
              $.ajax({
                type:"POST",
                url:"<%:Url.Action("Load","Desktop") %>",
                data:"numPage="+numPage+"&CurrentPage="+CurrentPage+"",
                cache:false,
                async:false,
                success:function(html)
                { 
                //document.getElementById("tablecloth").innerHTML=html;
                   $("#tablecloth").html(html);
                   $("#labPage").html(CurrentPage+"/"+countPage);
                    var tb2hg=  $("#memberTable").css("height");
                   //$("#pageDIV").css("top",tb2hg);
                   tablecloth();
                }
                })
        }

          $.ajax({
            type:"POST",
            url:"<%:Url.Action("CountPage_Load","Desktop") %>",
            data:"numPage="+numPage+"",
            cache:false,
            success:function(html)
            {
                countPage=html;
                $("#labPage").html(""+CurrentPage+"/"+countPage+"");

            }
        })

          function FirstPage()
        {
            CurrentPage=1;
                  if(ListPage==1)
                {
                    nextPageLoad();
                }
                if(ListPage==2)
                {
                   wastebook_nextPage();
                     $("#labPage").html(CurrentPage+"/"+countPage);
                }
        }

        function UpperPage()
        {
              if(CurrentPage==1)
            {
                layer.alert("已是最小页数",8,"提示");
            }
            else
            {
                CurrentPage--;
                 if(ListPage==1)
                {
                    nextPageLoad();
                }
                if(ListPage==2)
                {
                   wastebook_nextPage();
                     $("#labPage").html(CurrentPage+"/"+countPage);
                }
         
                
            }
        }
        function NextPage()
        {
            if(CurrentPage==countPage)
            {
                layer.alert("已是最大页数",8,"提示");
            }
            else
            {

                CurrentPage++;
                if(ListPage==1)
                {
                    nextPageLoad();
                }
                if(ListPage==2)
                {
                   wastebook_nextPage();
                     $("#labPage").html(CurrentPage+"/"+countPage);
                }
                
            }
        }
        function EndPage()
        {
            CurrentPage=countPage;
                  if(ListPage==1)
                {
                    nextPageLoad();
                }
                if(ListPage==2)
                {
                   wastebook_nextPage();
                     $("#labPage").html(CurrentPage+"/"+countPage);
                }
        }

        function JupmA()
        {
            var num=$("#txtJupmPage").val();
            if(parseInt(num)>parseInt(countPage)|| parseInt(num)<=0 )
            {
                layer.alert("超出页数范围！");
                return;
            }
            else
            {
                 CurrentPage=num;
                
                 if(ListPage==1)
                {
                    nextPageLoad();
                }
                if(ListPage==2)
                {
                   wastebook_nextPage();
                     $("#labPage").html(CurrentPage+"/"+countPage);
                }
            }
        }
        //读卡
      function RfidCardReadSectorData() {
       
        if(RequestStatus()==1){
        var hComm = 0;

        hComm = GetCOM();
         
        sData = vcp400.RfidCardReadSectorData(hComm, 0, 0, "", 15);

         $.ajax({
            type:"POST",
            url:"<%:Url.Action("getOneMember","Desktop") %>",
            data:"memberCardId="+sData+"",
            cache:false,
            success:function(html)
            {
                 $("#tablecloth").html(html); 
                 $("#pageDIV").css("visibility", "hidden");
            }
        });
        vcp400.ocx_CommClose(hComm);
      
      }
    }
    //进卡
    function CardInOver() {
     if(RequestStatus()==1){
        var hComm = 0;

        hComm = GetCOM();

        vcp400.CardInOver(hComm, 10); 	// 进卡

        vcp400.ocx_CommClose(hComm);
     }
    }
    // 退卡	
    function Dischange() {
      if(RequestStatus()==1){
        var hComm = 0;

        hComm = GetCOM();

        vcp400.Dischange(hComm, 1, 10); 	// 0=不完全退卡,1=完全退卡

        vcp400.ocx_CommClose(hComm);
     }
    }
    
   //进行擦除
   function Erase(){
     if(RequestStatus()==1){
      PrintBufferClear();
	  var hComm=0;

     hComm=GetCOM();

	 vcp400.ErasePrintDischarge(hComm,0,1,1,15);	
     Dischange();
	 vcp400.ocx_CommClose(hComm);
     }
	}
      // 清空打印缓存
        function PrintBufferClear() {
            var hComm = 0;

            hComm = GetCOM();

            vcp400.PrintBufferClear(hComm, 15);
            
            vcp400.ocx_CommClose(hComm);

        }
    function GetCOM() {
        COM = 100;
        Baud = 57600;

        return vcp400.ocx_commopen(COM, Baud);
    }
     // 获取机器状态	
        function RequestStatus() {
            var hComm = 0; 
            hComm = GetCOM(); 
            sState = vcp400.RequestStatus(hComm, 1); 
            if (sState.length = 6) {
                nchar = sState.charAt(0);
                switch (parseInt(nchar)) {
                    case 1: return 1;
                     break;
                } 
                nchar = sState.charAt(3);
                switch (parseInt(nchar)) {
                    case 1: return 1; break; 
                } 
            } 
            vcp400.ocx_CommClose(hComm); 
        }	
    function return_self(){
      window.location.href="/Loading/Index/?src=/Desktop/Index/";
    }
    </script> 
    <script src="../../Content/tablecloth/tablecloth.js" type="text/javascript"></script>